<tpl var layoutBody={ />
<div data-identity="home" data-table="sys_user">
	<div class="layui-breadcrumb">
		<a href="/manage/index.jspx">首页</a>
		<a href="javascript:;">
			<cite>安全设置</cite>
		</a>
	</div>
	<hr>
	<fieldset class="layui-elem-field">
		<legend>安全设置</legend>
		<div class="layui-field-box">
			<form class="layui-form" action="save.json?oper=update" lay-filter="mSysUserForm">
				<div class="layui-form-item" data-type="varchar" data-isnull="YES" data-name="name">
					<label class="layui-form-label">用户名称：</label>
					<div class="layui-input-block">
						<input type="text" name="name" placeholder="请输入用户名称" autocomplete="off" class="layui-input" value="${session.SESSION_USER_INFO.name!}">
					</div>
				</div>
				<div class="layui-form-item" data-type="varchar" data-isnull="NO" data-name="phone">
					<label class="layui-form-label">联系方式：</label>
					<div class="layui-input-block">
						<input type="text" name="phone" placeholder="请输入用户联系方式" autocomplete="off" class="layui-input" value="${session.SESSION_USER_INFO.phone!}">
					</div>
				</div>
				<div class="layui-form-item" data-type="varchar" data-isnull="YES" data-name="qq">
					<label class="layui-form-label">联系QQ：</label>
					<div class="layui-input-block">
						<input type="text" name="qq" placeholder="请输入联系QQ" autocomplete="off" class="layui-input" value="${session.SESSION_USER_INFO.qq!}">
					</div>
				</div>
				<div class="layui-form-item" data-type="varchar" data-isnull="YES" data-name="email">
					<label class="layui-form-label">联系邮箱：</label>
					<div class="layui-input-block">
						<input type="text" name="email" placeholder="请输入联系邮箱" autocomplete="off" class="layui-input" value="${session.SESSION_USER_INFO.email!}">
					</div>
				</div>
				<div class="layui-form-item" data-type="varchar" data-isnull="YES" data-name="avatar">
					<label class="layui-form-label">头像：</label>
					<div class="layui-input-avatar edit" id="user-avatar">
						<img src='${session.SESSION_USER_INFO.avatar!,image="avatar"}' id="upload" class="layui-input-avatar-view">
						<input type="text" name="avatar" class="layui-input-avatar-value" value="${session.SESSION_USER_INFO.avatar!}">
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit lay-filter="mSysUserForm">立即提交</button>
					</div>
				</div>
			</form>
		</div>
	</fieldset>
</div>
<tpl }; />

<tpl var layoutScript={ />
<script type="text/javascript">
	layui.config({
		base: '${webCdn}/plugins/layui/modules/'
	}).extend({
		http: 'http/http.min',
		message: 'message/message.min'
	}).use(['element', 'message', 'http', 'upload', 'form'], function () {
		// 绑定表单提交事件
		layui.form.on('submit(mSysUserForm)', function (data) {
			layui.http.post('edit/save.json', data.field, function (res) {
				layui.message.success(res.message);
			});

			return false;
		});

		// 头像上传组件
		layui.upload.render({
			elem: '#upload',
			url: '/upload/image/base.json',
			done: function (res) {
				if (!res || res.code !== 'SUCCESS') {
					return layui.message.failure(res.message);
				}

				$('#user-avatar input[name="avatar"]').val(res.data);
				$('#user-avatar img').attr('src', '/down/image/' + res.data);
			},
			error: function () {
				layui.message.failure('上传失败');
			}
		});
	});
</script>
<tpl }; />
<tpl include( "../../tpl/layout-scroll.html" ,{identity: "home" ,layoutBody:layoutBody,layoutScript:layoutScript}){} />